% Matlab file to implement class "deriv1",
% forward mode of automatic differentation, first derivatives
% Michael Reiter, Universitat Pompeu Fabra, April 2007
% Last update: -
% Feel free to use, copy and modify at your own risk;
%   this program comes with NO WARRANTY WHATSOEVER
% 
function xOut=horzcat(varargin)
  nv = length(varargin);
  for i=1:nv
    if(isa(varargin{i},'der1'))
      np = nindep(varargin{i});
      break;
    end
  end
  for i=1:nv
    if(isa(varargin{i},'der1'))
      vs{i} = varargin{i}.v;
      ds{i} = varargin{i}.d;
    else
      vs{i} = varargin{i};
      ds{i} = zeros([np size(vs{i})]);
    end
  end
  xOut.v = horzcat(vs{:});
  xOut.d = cat(3,ds{:});
  xOut=class(xOut,'der1');


